package com.atguigu.tingshu.album.api;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.TimeUnit;

/**
 * @author atguigu-mqx
 * @ClassName TestQueue
 * @description: TODO
 * @date 2023年11月10日
 * @version: 1.0
 */
public class TestQueue {

    public static void main(String[] args) throws InterruptedException {
        ArrayBlockingQueue<String> blockingQueue = new ArrayBlockingQueue<>(3);

        System.out.println(blockingQueue.offer("a"));
        System.out.println(blockingQueue.offer("b"));
        System.out.println(blockingQueue.offer("c"));
        System.out.println(blockingQueue.offer("a", 3, TimeUnit.SECONDS));
        //  blockingQueue.put(); blockingQueue.take();
        System.out.println(blockingQueue.poll());
        System.out.println(blockingQueue.take());
    }
}
